#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

typedef struct {
	unsigned char a[4];
	unsigned char b[4];
	unsigned char c[8];
}DEF;

int main() {
	DEF d;
	memset(&d, 0x00, sizeof(DEF));
	unsigned char a[32] = {0};
	int fd = open("/tmp/1", O_RDONLY);
	int ret = 0;
	if (fd > 0) {
		ret = read(fd, a, 32);
		printf("\33[32m [MARCO][%d]---[%d]---\33[0m\n", __LINE__, ret); 
		close(fd);
	}
	int len = 0;
	for (len = 0; len < 32; ++len) {
		printf("[%02x]", a[len]);
	}
	printf("\n"); 

	memcpy(&d, a, sizeof(DEF));
	printf("\33[32m [MARCO][%d]---A[%02x][%02x][%02x][%02x]---\33[0m\n", __LINE__, d.a[0], d.a[1], d.a[2], d.a[3]); 
	printf("\33[32m [MARCO][%d]---B[%02x][%02x][%02x][%02x]---\33[0m\n", __LINE__, d.b[0], d.b[1], d.b[2], d.b[3]); 
	printf("\33[32m [MARCO][%d]---C[%02x][%02x][%02x][%02x]---\33[0m\n", __LINE__, d.c[0], d.c[1], d.c[2], d.c[3]); 
	printf("\33[32m [MARCO][%d]---C[%02x][%02x][%02x][%02x]---\33[0m\n", __LINE__, d.c[4], d.c[5], d.c[6], d.c[7]); 


	return 0;
}
